package com.atguigu.srb.sms.client.fallback;

import com.atguigu.srb.sms.client.CoreUserInfoClient;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class CoreUserInfoClientFallback implements FallbackFactory<CoreUserInfoClient> {
    @Override
    public CoreUserInfoClient create(Throwable throwable) {
        return new CoreUserInfoClient() {

            @Override
            public boolean checkMobile(String mobile) {
                log.error("远程调用失败，服务熔断");
                return false;
            }
        };
    }
}
